package com.example.com.skills_utf8;

import android.app.ActionBar;
import android.app.ActionBar.OnNavigationListener;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SpinnerAdapter;

public class ActionBar27Activity extends Activity{

	ActionBar27Activity activity = this;
	private SpinnerAdapter mSpinnerAdapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setTheme(android.R.style.Theme_Holo);
		setContentView(R.layout.activity_theme27);

		
		///*1  OK
		mSpinnerAdapter = ArrayAdapter.createFromResource(
				this, 
				R.array.fruit, 
				android.R.layout.simple_spinner_dropdown_item);
		
		ActionBar actionBar = getActionBar();
		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
		actionBar.setDisplayShowTitleEnabled(true); //应用程序的title, 我在manifast中theme设置了notitle; 这里为true将其开启了;
		actionBar.setListNavigationCallbacks(mSpinnerAdapter,  new OnNavigationListener() {
			
			@Override
			public boolean onNavigationItemSelected(int itemPosition, long itemId) {
				// TODO Auto-generated method stub
				return false;
			}
		});
		//1*/
		
		
	        
		
	
		
		
	}
	
	
	/*
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		
		 // Inflate the menu items for use in the action bar
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.action_menu, menu);
		
	  
	    // 搜索
	    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
	    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
	        @Override
	        public boolean onQueryTextSubmit(String s) {
	            Utils1.showToastShort(activity, s);
	            return true;
	        }
	 
	        @Override
	        public boolean onQueryTextChange(String s) {
	            return false;
	        }
	    });
	    
		
		return super.onCreateOptionsMenu(menu);
	}
	*/
	
	
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		
		
		
		return super.onOptionsItemSelected(item);
	}
	
	
	
	
	
}
